package erfgame.core.world.terrain.async;

import java.awt.Point;
import java.util.concurrent.Executor;


import erfgame.core.Point3D;
import erfgame.core.Point3DAndRotation;
import erfgame.core.dao.ObjectDAO;
import erfgame.core.entity.Entity;
import erfgame.core.memory.Pointer;
import erfgame.core.world.World;
import erfgame.core.world.WorldDAO;
import erfgame.core.world.WorldDAOManager;
import erfgame.core.world.terrain.BlockEntityPositions;
import erfgame.core.world.terrain.BlockGridTiles;
import erfgame.core.world.terrain.BlockSurfaceImages;

public class UnsafeAsyncWorldDAOManagerProxy implements WorldDAOManager {
	
	private Executor executor;
	private WorldDAOManager proxied;
	
	public UnsafeAsyncWorldDAOManagerProxy( WorldDAOManager proxied, Executor executor ) {
		this.proxied = proxied; 
		this.executor = executor;
	}
	
	public ObjectDAO<Point3DAndRotation, BlockSurfaceImages> getBlockSurfaceImagesDAO(World world) {
		return new UnsafeAsyncObjectDAOProxy<Point3DAndRotation, BlockSurfaceImages>(
				this.proxied.getBlockSurfaceImagesDAO( world ),
				this.executor
		);
	}

	public ObjectDAO<Point3D, Pointer<byte[][][]>> getBlockTerrainDAO(World world) {
		return new UnsafeAsyncPointerDAOProxy<Point3D, byte[][][]>(
				this.proxied.getBlockTerrainDAO(world), 
				this.executor
		);
	}
	
	public ObjectDAO<Point, BlockGridTiles> getGridTilesDAO(World world) {
		return new UnsafeAsyncObjectDAOProxy<Point, BlockGridTiles>(
				this.proxied.getGridTilesDAO(world), 
				this.executor 
		);
	}

	public ObjectDAO<Point, int[][][]> getSurfacesDAO(World world) {
		return new UnsafeAsyncObjectDAOProxy<Point, int[][][]>(
				this.proxied.getSurfacesDAO(world), 
				this.executor
		);
	}
	
	public ObjectDAO<Long, Entity> getEntityDAO(World world) {
		return new UnsafeAsyncObjectDAOProxy<Long, Entity>(
				this.proxied.getEntityDAO(world), 
				this.executor
		);
	}
	
	public ObjectDAO<Point3D, BlockEntityPositions> getBlockEntityPositionsDAO(
			World world) {
		return new UnsafeAsyncObjectDAOProxy<Point3D, BlockEntityPositions>(
				this.proxied.getBlockEntityPositionsDAO(world), 
				this.executor
		);

	}

	public WorldDAO getWorldDAO() {
		return this.proxied.getWorldDAO();
	}

}
